package cn.cangli.controller;

import cn.cangli.pojo.Clazz;
import cn.cangli.pojo.ClazzQuery;
import cn.cangli.pojo.Result;
import cn.cangli.service.ClazzService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/class")
public class ClazzController {
    @Autowired
    private ClazzService clazzService;
    @GetMapping
    public Result pageList(ClazzQuery clazzQuery){
        List<Clazz> list = clazzService.list(clazzQuery);
        return Result.success(list);
    }

    @DeleteMapping("/{id}")
    public Result delete(@PathVariable Integer id){
        clazzService.delete(id);
        return Result.success();
    }
}
